;input variables required; [s] [zs] [k]
;outputs; [recess]
;
{AddTable:'{SysPath:Toolbox}\ASME (Inch)\_Common\ASME B18.6.3_Type VI.csv'}
;import the torx shape
_-Import "{SysPath:Toolbox}\ASME (Inch)\_Common\ASME B18.6.3_Type VI.3dm" _Enter
;scale the socket
_Scale 0,0,0 [A]
;place the socket
{Set:[A]={ToDocUnits:[A]}}
{Set:[tip]={Math:([A]/2)*tan(30d)}} ; penetration gage is the hexalobular only (don't include the tip) ASME B18.6.3 Page 92
_Move 0,0,0 0,0,[zs]-[tip]
{Set:[recess]={SelectedObjs}}
_SelNone
;
;Counterbore (only flat heads)
{If:[zk]<>Nothing}
	_Circle _2Point (-[A]/2)-[tol],0,0 ([A]/2)+[tol],0,0
	_SelLast
	{ExtrudeCrv:[tol]:0,0,[A]}
	{Set:[cb]={ToDocUnits:0.007}} ; < 0.005 in up to socket No. 15, < 0.01 in over socket No. 15
	_Move 0,0,0 0,0,[zk]-[cb]
	;
	_SelId [recess]
	{BooleanUnion:[tol]}
	{Set:[recess]={SelectedObjs}}
	_SelNone
{EndIf:}